# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=desmume
pkgver=0.9.13
pkgrel=2
pkgdesc="Nintendo DS emulator"
url="https://desmume.org"
arch="all !s390x !ppc64le !riscv64" # fails to build
license="GPL-2.0-or-later"
makedepends="meson glib-dev sdl2-dev libpcap-dev gtk+3.0-dev"
subpackages="$pkgname-doc"
source="https://github.com/TASEmulators/desmume/releases/download/release_${pkgver//\./_}/desmume-$pkgver.tar.xz
	0001-Fix-compiling-on-GCC-for-AArch64.-Fixes-548.patch
	0002-Define-_POSIX_C_SOURCE-for-clock_gettime.patch
	format-security.patch
	"

build() {
	abuild-meson \
		desmume/src/frontend/posix \
		output
	meson compile -C output
}

check() {
	meson test --no-rebuild -v -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
b756c5a5d79479e38c6135e4dcff3bdbaf78a4860699320305c81056bd6e7b8ba4db3c3d3879e2ac226b095783357b9f579c0486cafbbbdcee8456e1469efd9e  desmume-0.9.13.tar.xz
6c0463612bec66dfeddc027c5466e122e8ebce4792d0670f69329fed981a033ab0a43ec80247d406fe317868b65ae0d9f736f1ec21e7cabbdf5f97e42666f8ab  0001-Fix-compiling-on-GCC-for-AArch64.-Fixes-548.patch
29b14fff7ce9c21ed1495586334c0ade1a56226ad022bce10440dc5c67149e9388a6f922b1b2a11ce913b410c3815e9f2eb31ceb36ac4508d82bef167b33f998  0002-Define-_POSIX_C_SOURCE-for-clock_gettime.patch
e2bf0d6881cc2a99ccc0c311a86195ca50a7806590eb48d9285048105edef91f869fb525d81dba85fa84115c0c18a86f0f4e5c78fdcfc5422b76be827396b4e0  format-security.patch
"
